package algorithms.implementation


import redirectSystemIn
import redirectSystemOut
import org.junit.jupiter.api.Test
import java.util.*

class FormingMagicSquareTests {
    @Test
    fun formingMagicSquareTest() {
        redirectSystemIn(this.javaClass) {
            val scan = Scanner(System.`in`)
            redirectSystemOut {
                while (scan.hasNextLine()) {
                    val s = Array(size = 3) { Array(3) { 0 } }

                    for (i in 0 until 3) {
                        s[i] = scan.nextLine().split(" ").map { it.trim().toInt() }.toTypedArray()
                    }

                    val result = formingMagicSquare(s)

                    println(result)
                    it.add(scan.nextLine().trim())
                }
            }
        }
    }
}